package cn.itcast.ssm.controller;

import cn.itcast.ssm.exception.CustomException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.io.IOException;

/**
 * Description:
 * Created by t410 on 2017/7/6.
 */
@Controller
@RequestMapping("/testException")
public class ExceptionMapping {

    private String successJsp="success";


    @RequestMapping(value="/demo1")
    public String demo1() throws CustomException {
        throw new CustomException(" 可捕获异常 被 处理");
    }

    @RequestMapping(value="/demo2")
    public String demo2() throws IOException {
        throw new IOException(" Io 异常 被 处理");
    }

    @RequestMapping(value="/demo3")
    public String demo3() throws RuntimeException {
        throw new RuntimeException(" RuntimeException 被 处理");
    }

    @RequestMapping(value="/demo4")
    public String demo4()  {
        throw new RuntimeException(" RuntimeException ------------ 被 处理");
    }
}
